﻿using Com.JunCaiSoft.DBContext;
using Com.JunCaiSoft.Freeze.Dao;
using Com.JunCaiSoft.Freeze.IDao;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Com.JunCaiSoft.ConstructionCashFlow
{
    public static class FreezeServiceCollectionExtension
    {
        public static IServiceCollection AddFreeze(this IServiceCollection services)
        {
            //添加冻结资金相关注入
            services.TryAddSingleton<IFreezeMoneyDao>(new FreezeMoneyDao(services.BuildServiceProvider().GetService<MSSQLDbContext>()));

            //添加借条管理相关注入
            services.TryAddSingleton<ICreditContractDao>(new CreditContractDao(services.BuildServiceProvider().GetService<MSSQLDbContext>()));

            //添加解冻资金相关注入
            services.TryAddSingleton<IUnFreezeMoneyDao>(new UnFreezeMoneyDao(services.BuildServiceProvider().GetService<MSSQLDbContext>()));

            return services;
        }
    }
}
